const str:string = '123'

const num:number = 123

const bool:boolean = false

const any:any = false

const arr:[string,string,string,number] = ['1','2','4', 4]

// 枚举 
enum objType {
    name =  '张三',
    age = '李四'
}

// 接口
interface infoType {
    name: string,
    age: number,
    sex: boolean
}

interface infoObj {
    name: string,
    age: string,
    sex: boolean
}



function getName (info: infoType|infoObj):void {

    if (typeof info.age as infoObj['age'])  {
        console.log('我使用的是infoObj接口')
    } else {
        console.log('我使用的是infotype接口')
    }
    console.log(info)
}



// const info: objType =objType['age']


getName({
    name: '张三',
    age: '12',
    sex: true
})

console.log(any)